-- DO_CAREER_217_LEARN_EFFECT

-- 学习称号传奇猎手的特殊效果
-- @param user     玩家对象
-- @param careerId 称号id
return function(user, careerId)
    -- 可直接升级【猎魔弩】为【传奇之弩】
    local origEquipId = 8504;
    local dstEquipId  = 8507;

    -- 天空副本中获得无效的对应物品
    local dungeonId = DungeonM.getDungeonId();
    if type(dungeonId) == "number" and dungeonId > 0 and
        DungeonAreaM.query(dungeonId, "type") == "sky_instance" or 
        type(dungeonId) == "number" and dungeonId > 0 and
        DungeonAreaM.query(dungeonId, "type") == "activity" then
        dstEquipId  = 8516;
    end

    -- 如果有源装备，直接升级
    if EquipM.hasEquipment(origEquipId) then
        EquipM.upgradeEquip(origEquipId, dstEquipId);
    end
end